<!--
 * @description  :运输首页的铁路list
 * @descriptionDetail:运输首页的铁路list
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-10-09 22:21:21
-->
<template>
  <view class="lt-root" @tap="itemClick">
    <view class="lt-row It-title-state">
      <view class="It-title-sty">
        <view class="lt-left-label">
          班次名：
        </view>
        <view class="lt-right-value">
          {{ itemInfo.serviceName }}
        </view>
      </view>
      <view>
        <u-tag style="flex-shrink: 0;margin-right: 20rpx;" :spStyle="getSpStyle(itemInfo)" mode="dark" shape="circle" :text="isActiveName"></u-tag>
      </view>
    </view>
    <view class="lt-row">
      <text class="lt-left-label">
        始发站：
      </text>
      <text class="lt-right-value">
        {{ itemInfo.startStation }}
      </text>
    </view>
    <view class="lt-row">
      <text class="lt-left-label">
        途径站：
      </text>
      <text class="lt-right-value">
        {{ itemInfo.pathWayStation }}
      </text>
    </view>
    <view class="lt-row">
      <text class="lt-left-label">
        终点站：
      </text>
      <text class="lt-right-value">
        {{ itemInfo.endStation }}
      </text>
    </view>
    <view class="lt-row">
      <text class="lt-left-label">
        铁路局：
      </text>
      <text class="lt-right-value">
        {{ itemInfo.trainName }}
      </text>
    </view>
  </view>
</template>

<script>
const sysCodeColors = {
  "1": {
    color: "#0079F2",
    borderColor: "#0079F2",
    backgroundColor: "#E0ECFF",
  },
  "0": {
    color: "#AC0000",
    borderColor: "#AC0000",
    backgroundColor: "#F2CCCC",
  },
};
export default{
  name:"ListItemRailRoadTransport",
  props:{
    itemInfo:{
      type: Object,
      default:() => { return {} },
    },
  },
  data(){
    return {
      isActive: this.itemInfo.isActive ? '1' : '0',
      isActiveName:this.itemInfo.isActive ? '启用' : '停用',
    };
  },
  watch: {
    "itemInfo.isActive" (newValue, oldValue) {
      this.isActive = newValue ? '1' : '0';
      this.isActiveName = newValue ? '启用' : '停用';
    },
  },
  created() {

  },
  methods:{
    itemClick(){
      this.setRouteParam(this.itemInfo);
      // 跳转到 铁路的详情页面
      this.$u.route("/pages/intelligence/intelligenceFilesInfo/railroadtransportArchive");
    },
    getSpStyle(it){
      if(it.isActive == this.isActive){
        return sysCodeColors[this.isActive] || {};
      }else if(it.isActive == this.isActive){
        return sysCodeColors[this.isActive] || {};
      }
    },
  },
}
</script>

<style scoped lang="scss">
@import "../list_item.scss";
</style>
